<template>
    <el-dialog v-model="show" title="烫金版入库" align-center width="26%" @close="handleClose">

        <h3 style="font-weight: 700;">客户名称：{{ props.customerName }}</h3>

        <div class="mb20" v-for="(item, index) in props.initList" :key="index">
            <div>
                <strong>烫金版1：</strong> {{  item.gildingName  }}
            </div>
            <el-row :gutter="20" class="mb8">
                <el-col :span="1.5">
                    烫金版总数：{{ item.dataList.length }}
                </el-col>
                <el-col :span="1.5">
                    烫金版库位：{{ item.warehouseLocation  }}
                </el-col>
                <el-col :span="1.5">
                    烫金版编号：{{  item.gildingCode  }}
                </el-col>
            </el-row>
            <el-button type="success">打印</el-button>
        </div>

        <template #footer>
            <div class="dialog-footer">
                <el-button @click="handleClose">取 消</el-button>
                <el-button type="primary" @click="handleSubmit">保 存</el-button>
            </div>
        </template>
    </el-dialog>
</template>

<script setup lang="ts">
import { gildingReadyApi } from '@/api/sj/productManagement/designerTakesOrders/index';

const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const props = defineProps(['visible', 'initList', 'acceptId', 'customerName']);
const emits = defineEmits(['submit', 'close']);

watch(() => props.visible, async (newValue) => {
    show.value = props.visible
    if (newValue) {
    }
}, { deep: true });

const show = ref(false);

const handleSubmit = async () => {
    try {
        const {code} = await gildingReadyApi({
            id: props.acceptId
        })

        if(code == 200){
            proxy?.$modal.msgWarning('保存成功');
            emits('submit', true);
            handleClose()
        }

    } catch (error) {
        
    }

};

const handleClose = () => {
    emits('close');
};
</script>

<style lang="scss" scoped>
.el-select {
    width: 100%;
}
</style>